package com.hd.appcommon.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hd.appcommon.entity.Privilege;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 权限 Mapper 接口
 * </p>
 *
 * @author administrator
 * @since 2020-11-26
 */
public interface PrivilegeMapper extends BaseMapper<Privilege> {

    @Select("  select p.* from privilege p " +
            "  inner join role_privilege rp " +
            "  on p.privilege_id = rp.privilege_id " +
            "  where rp.role_id = #{roleId} " +
            "  and p.deletable = #{unDelete} ")
    List<Privilege> listByRoleId(@Param("roleId") String roleId, @Param("unDelete") int unDelete);
}
